package com.alison.importbeandefinitionregister;

import com.alison.domain.BeanBRegister;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.util.StringUtils;

/**
 * @Author alison
 * @Date 2024/3/27 13:53
 * @Version 1.0
 * @Description
 */

/*

 */
public class ImportBeanDefinitionRegistrarImpl implements ImportBeanDefinitionRegistrar {

    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
//        ImportBeanDefinitionRegistrar.super.registerBeanDefinitions(importingClassMetadata, registry);

        RootBeanDefinition beanDefinition = new RootBeanDefinition();
        beanDefinition.setBeanClass(BeanBRegister.class);
        String beanName = StringUtils.uncapitalize(BeanBRegister.class.getName());
        registry.registerBeanDefinition(beanName, beanDefinition);
    }
}
